<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="css/common.css" type="text/css" />
<script language="javascript" src="js/jquery-1.4.2.min.js"></script>
<script language="javascript" src="js/jquery.checkboxes.min.js"></script>
<script language="javascript" src="js/tableRowCheckboxToggle.js"></script>
<script>
$(document).ready(function(){
		//點擊事件切換 全選取消狀態
		$("#selectall").click( function (){ $("#grouplist").toggleCheckboxes(); });
		$("tr").attr("bgColor","#FFFFFF");
		$("tr").hover(
		  function(){
			$(this).addClass("hover");    //鼠標經過添加hover樣式
		  },
		  function(){
			$(this).removeClass("hover");   //鼠標離開移除hover樣式
		  }
		);

	});

/*
$("#grouplist").toggleCheckboxes(); 
$("#grouplist").toggleCheckboxes()//全選,取消全選,反選 
$("#grouplist").toggleCheckboxes(":not(#checkbox1)")//全選,取消全選且不選中第一個,反選 
$("#grouplist").toggleCheckboxes(".top5", true)//全選,取消全選且只選前五個,反選 
$("#grouplist").checkCheckboxes();// 全選 
$("#grouplist").checkCheckboxes(":not(#checkbox1)");//除第一個之外全選 
$("#grouplist").checkCheckboxes(".top5", true);//前五個全選 
$("#grouplist").unCheckCheckboxes(); //取消全選 
$("#grouplist").unCheckCheckboxes(":not(#checkbox1)");//取消全選,排除第一個 
$("#grouplist").unCheckCheckboxes(".top5", true);//取消全選排除前五個 
*/



</script>
<style type="text/css">
.hover{background-color:#FFF2CA;}  /*這裡是鼠標經過時的顏色*/
</style> 
<title>團購列表</title>
</head>

<body>
<div id="man_zone">
<form method="post" name="search" id="search">
<table width="99%" align="center"  border="0" cellpadding="3" cellspacing="1" class="table_style">
	<tr>
		<td>
			團購ID(多個ID請用 , 隔開。):<input type="text" name="gid" size="10" />
			<input type="submit" name="Submit3" value="搜索" />
		</td>
	</tr>
</table>
</form>

<form method="post" name="grouplist" id="grouplist">
<?php //print_r($dataarray);?>

  <table width="99%" align="center"  border="0" cellpadding="3" cellspacing="1" class="table_style">
    <tr>
      <th width="2%"><label>
        <input type="checkbox" name="checkbox" value="checkbox" id="selectall" />
      </label></th>
      <th width="4%">編號</th>
      <th width="5%">團購類型</th>
      <th width="10%">團購名稱</th>
      <th width="4%">產品類型</th>
      <th width="8%">團購價</th>
      <th width="11%">團購結束時間</th>
      <th width="12%">供貨商</th>
      <th width="4%">排序</th>
      <th width="10%">訂單操作</th>
      <th width="14%">團購卷</th>
      <th width="5%">團購人數</th>
      <th width="5%">團購狀態</th>
      <th width="7%">操作</th>
    </tr>
	<?php if(is_array($dataarray)){foreach($dataarray as $value){?>
    <tr class="odd_row">
      <td align="center"><input type="checkbox" name="checkbox2" value="checkbox" /></td>
      <td><?php echo $value['gid']?></td>
      <td><?php echo $value['group_type']?></td>
      <td><?php echo $value['title']?>&nbsp;</td>
      <td><?php echo $value['subtitle']?>&nbsp;</td>
      <td>$<?php echo $value['shop_price']?>&nbsp;</td>
      <td><?php echo date("Y-m-d H:i",$value['group_end_time']);?>&nbsp;</td>
      <td><?php echo $value['name']?>&nbsp;</td>
      <td><?php echo $value['order']?>&nbsp;</td>
      <td> 
      <a href="order_excel.php?gid=<?php echo $value['gid']?>">[匯出報表]</a><br/>
	  <a href="order_excel_123.php?gid=<?php echo $value['gid']?>">[匯出123合購報表]</a><br/>
      <a href="order_list.php?gid=<?php echo $value['gid']?>">[管理訂單]</a><br/>
      
      </td>
      <td>
	  <?php if($value['gtypeid']==0){ ?>
	  <a href="groupbond_list2.php?gid=<?php echo $value['gid']?>">[商家報表]</a><br /><a href="groupbond_list.php?gid=<?php echo $value['gid']?>">[團購卷管理]</a>&nbsp;<a target="_blank" href="groupbond_listprint.php?gid=<?php echo $value['gid']?>">[打印]</a>&nbsp;<a href="groups_list.php?action=autobind&gid=<?php echo $value['gid']?>">[自動分配]</a><br/>
	  
	  (需生成<font color="red"><?php echo $value['stock']?></font>個團購卷)<br/>
	  (已經生成<font color="red"><?php echo getbondnum($value['gid'])?></font>個團購卷)<br/>
	  (已經分配<font color="red"><?php echo getbondnum($value['gid'],"used")?></font>個團購卷)<br/>
	  (剩餘<font color="red"><?php echo getbondnum($value['gid'],"last")?></font>個團購卷)
	  
	  <?php }elseif($value['gtypeid']==1){ ?>
	  實物無需購物卷
	  <?php }?>
	  </td>
      <td><?php echo $value['group_buynum']?>&nbsp;</td>
      <td><?php 
	  
	  if($value['group_end_time']<=$timestamp){
	  	echo "已結束";
	  }else{
	  	echo $TGSTATE[$value['group_state']];
	  }
	  
	  ?>&nbsp;</td>
      <td>
	  <?php if($value['state']==0){?>
	  
	  <a href="groups_list.php?action=restore&gid=<?php echo $value['gid']?>">恢復</a>|
	  <a href="javascript:if(confirm('確實要刪除嗎?'))location='groups_list.php?action=delr&gid=<?php echo $value['gid']?>'">刪除</a>
	  <?php }else{?>
	  <a href="groups_list.php?action=edit&gid=<?php echo $value['gid']?>">編輯</a>|
	  <a href="javascript:if(confirm('確實要刪除嗎?'))location='groups_list.php?action=del&gid=<?php echo $value['gid']?>'">刪除</a>
	  <?php }?>
	 
	  
	  </td>
    </tr>
	<?php }}else{?>
	<tr><td colspan=12>暫無數據..............</td></tr>
	<?php };?>
  </table>
  
  </form>
  <div style="width:99%;margin:0px auto;">
  <?php echo multi($total,$pagesize,$page,"");?>
  </div>
</div>
</body>
</html>
